package com.wlper.lib.uitls;

import android.util.Log;

public class LogUtils {

    public final static String TEST_TAG = "test";
    public final static String NET_WORK_TAG = "NetworkLog";
    public final static String NET_WORK_ERROR = "NetworkError";
    public final static String NET_WORK_RETURN = "NetworkReturn";

    private static boolean isLog = true;

    public static void switchLog(boolean b) {
        isLog = b;
    }

    public static void networkLog(String log) {
        String s = log == null ? "null" : log;
        if (isLog)
            Log.i(NET_WORK_TAG, s);
    }

    public static void logNetError(String error) {
        String s = NET_WORK_ERROR + "\n" + error;
        networkLog(s);
    }

    public static void logNetReturn(String method, String returns) {
        String s = NET_WORK_RETURN + "---" + method + "\n" + returns;
        networkLog(s);
    }

    public static void log(String log) {
        String s = log == null ? "null" : log;
        if (isLog)
            Log.i(TEST_TAG, s);
    }

}
